package com.itcncp.wechat.app.search.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author ShenHuaJie
 * @version 2016年6月21日 上午9:50:58
 */
@Configuration
@EnableWebMvc
@EnableSwagger2
@ComponentScan(basePackages = { "com.itcncp.wechat.app.search" })
public class SwaggerConfig {
	@Bean
	public Docket ProductApi() {
		return new Docket( DocumentationType.SWAGGER_2)
				.genericModelSubstitutes(DeferredResult.class)
				.useDefaultResponseMessages(false)
				.forCodeGeneration(false)
				.pathMapping("/")
				.select()
				.build()
				.apiInfo(productApiInfo());
	}

	private ApiInfo productApiInfo() {
		ApiInfoBuilder apiInfo = new ApiInfoBuilder();
		apiInfo.title( "ITC不停车收费-微信小程序API" );
		apiInfo.description( "©2017 Copyright. Powered By ITC." );
		apiInfo.contact( new Contact("ITC", "", "www.itc-pay.com") );
		apiInfo.license("Apache License Version 2.0");
		apiInfo.licenseUrl("https://github.com/springfox/springfox/blob/master/LICENSE").version("1.10");
		return apiInfo.build();

	}

}